<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta charset="utf-8"/>
    <title>最家</title>
    <link rel="stylesheet" type="text/css" href="css/public.css"/>
    <link rel="stylesheet" type="text/css" href="css/myorder.css"/>
</head>
<body><!------------------------------head------------------------------>
<div class="head ding">
    <div  th:replace="common :: head" ></div>

</div>
<div class="address mt">
    <div class="wrapper clearfix"><a href="/" class="fl">首页</a><span>/</span><a
            href="/mygxin">个人中心</a><span>/</span><a href="/myorderq" class="on">我的订单</a></div>
</div><!------------------------------Bott------------------------------>
<div class="Bott">
    <div class="wrapper clearfix">
        <div th:replace="common :: zuoFl"></div>
        <div class="you fl">
            <div class="my clearfix"><h2 class="fl">我的订单</h2><a href="#" class="fl">请谨防钓鱼链接或诈骗电话，了解更多&gt;</a></div>
            <div class="dlist clearfix" th:if="${not #lists.isEmpty(cartsList)}">
                <ul class="fl clearfix" id="wa">
                    <li class="on"><a href="#2">全部有效订单</a></li>
                    <li><a href="#2">待支付</a></li>
                    <li><a href="#2l">待收货</a></li>
                </ul>
                <form class="fr clearfix">
                    <input type="text" id="productName"  placeholder="请输入商品名称"/>
                    <input type="button" onclick="searchGoods()"/>
                </form>
            </div>
            <div th:if="${ #lists.isEmpty(cartsList)}">
                <a href="/" style="color: red;margin-top:50px;float: left;margin-left: 340px">你的订单没有商品,前往购买商品!!</a>
            </div>
            <div id="myorderq">
                <div th:if="${not #lists.isEmpty(cartsList)}" th:each="carts:${cartsList}" th:class="${carts.isReceiving?'dkuang':'dkuang clearfix deng'}">
                    <p th:text="${carts.isPayment==false?'待支付':'待收货'}" th:if="${carts.isReceiving==false}" th:class="${carts.isReceiving==false}?'one fl':'one'"  ></p>
                    <p  th:if="${carts.isReceiving}" class="one" >已收货</p>
                    <div class="clearfix" th:if="${carts.isReceiving==false && carts.isPayment}">
                        <div class="fl vewwl"><a href="/wuliu" class="ckwl">查看物流</a>
                            <div class="wuliu"><h4>圆通速递：858888888888888</h4>
                                <ul>
                                    <li><p>妥投投递并签收，已签收。签收人：本人签收</p>
                                        <p>2016-12-03 17:30:00</p></li>
                                    <li><p>深圳市南油速递营销部安排投递（投递员姓名：六六六。联系电话：14243452522;</p>
                                        <p>2016-12-03 08:50:00</p></li>
                                    <li><p>到达广东省邮政速递物流有限公司深圳航空邮件处理中心处理中心（经转）</p>
                                        <p>2016-12-03 02:20:00</p></li>
                                    <li>以上为最新跟踪信息<a href="wuliu.html">查看全部</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div  class="word clearfix">
                        <p class="fr" th:if="${carts.isPayment}" style="margin-top: -45px;float: right"  >订单金额：<span th:text="${carts.orderNumber*carts.goods.price}"></span>元</p>
                        <p class="fr" th:if="${carts.isPayment==false}" style="margin-top: 20px;float: right"  >订单金额：<span th:text="${carts.orderNumber*carts.goods.price}"></span>元</p>

                    </div>
                    <div class="shohou clearfix"><a th:href="@{'/prodetail?id='+${carts.goods.id}}" class="fl"><img th:src="${carts.goods.image}" height="70"/></a>
                        <p class="fl"><a th:href="@{'/prodetail?id='+${carts.goods.id}}" th:text="${carts.goods.title}">家用创意菜盘子圆盘 釉下彩复古</a><a href="#" th:text="${'¥'+carts.goods.price+'×'+carts.orderNumber}"></a></p>
                        <p class="fr">
                            <a th:href="@{'/order?id='+${carts.id}}"  th:if="${carts.isReceiving==false && carts.isPayment==false}">立即支付</a>
                            <a href="javascript:void(0)" onclick="upd(this.id)" th:id="${carts.id}"  th:if="${carts.isReceiving==false && carts.isPayment}">确认收货</a>
                            <a href="/myprod"  th:if="${carts.isReceiving && carts.isComment==false}">待评论</a>
                            <a href="javascript:void(0)"  th:if="${carts.isReceiving && carts.isComment}">已完结</a>
                            <a th:href="@{'/orderxq?id='+${carts.id}}">订单详情</a>
                        </p>
                    </div>
                </div>
            </div>


        </div>
    </div>
</div><!--返回顶部-->
<div th:replace="common :: gotop"></div>

<div  th:replace="common :: footer"></div>
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="js/user.js" type="text/javascript" charset="utf-8"></script>
<script>
    //确认收货
    function upd(id) {
        var isReceiving = true
        $.post('cart/upd',{id,isReceiving},function (result) {
            if(result=='ok'){
                $("#myorderq").load(location.href + " #myorderq")
            }
        })
    }
    function searchGoods() {
        var title = $("#productName").val()
        $("#myorderq").load('/myorderq?title='+title + " #myorderq")
    }
</script>
</body>
</html>